<!--
 * Description: RFQ solution页面
 * Company: 联宝（合肥）电子科技有限公司
 * Author: Chengming.Li
 * Date: 2020/11/24 11:26
-->

<template>
  <BaseWrap>
    <!-- 详情数据 -->
    <RfqDetailView v-if="isDetailData" :rowData="currentRowData" @cancel="isDetailData = false" />
    <!-- check 页面 -->
    <RfqCompare
      v-else-if="isCompareView"
      :rowData="currentRowData"
      @cancel="isCompareView = false"
      @update:State="rfqReload"
    />
    <!-- 基础数据 -->
    <RfqBaseData v-else ref="baseData" :rfqDataType="'0'" />
  </BaseWrap>
</template>

<script>
import RfqBaseData from '../components/RfqBaseData'
import RfqDetailView from '../components/RfqDetailView'
import RfqCompare from './components/RfqCompare'
export default {
  name: 'RfqOfficial',
  components: { RfqBaseData, RfqDetailView, RfqCompare },
  props: {},
  data() {
    return {
      // 是否显示详情数据
      isDetailData: false,
      // 是否显示check弹出框
      isCompareView: false,
      // 当前行的数据
      currentRowData: {}
    }
  },
  computed: {},
  watch: {},
  created() {
    /** 详情数据查看 */
    this.$bus.$on('rfq-detail-view', (index, rowData) => {
      this.currentRowData = rowData
      this.isDetailData = true
    })
    //  对比
    this.$bus.$on('rfq-compare-view', rowData => {
      this.currentRowData = rowData
      this.isCompareView = true
    })
  },
  mounted() {},
  beforeDestroy() {
    /** 详情数据查看 */
    this.$bus.$off('rfq-detail-view')
    this.$bus.$off('rfq-compare-view')
  },
  methods: {
    //  保存check状态后刷新页面
    rfqReload() {
      // this.$refs.baseData.pageDataInit()
    }
  }
}
</script>
